<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>229990309黄欣绮</title>
</head>
<body>
    <style>
        .reffle{
            width: 520px;
            border: 1px;
            text-align: center;
        }
        #result{
            width: 520px;
            height: 380px;
            line-height: 380px;
            text-align: center;
            font-size: 48px;
        }
        #btn{
            width: 118px;
            height: 98px;
            font-size: 24px;
            margin-top: 20px;
        }
    </style>

    <div class="reffle">
        <input id="result" type="text" value="" placeholder="点击抽奖" readonly>
        <button id="btn">抽奖</button>
    </div>

    <script>
        //获取id
        var prize=document.getElementById("result");
        var btn=document.getElementById("btn");
        //随机数函数
        function getNum(min,max){
            return Math.floor(Math.random()*(max-min+1)+min);
        }
        //鼠标点击事件
        var arrPrise=["华为Mate70pro","华为PadPro","小米14Ultra","su7模型","荣耀60i"];
        btn.addEventListener("click",function(event){
            prize.value=arrPrise[getNum(0,arrPrise.length-1)];
        })
    </script>
</body>
</html>